package com.sky.mapper;

import com.github.pagehelper.Page;
import com.sky.dto.DishPageQueryDTO;
import com.sky.entity.Dish;
import com.sky.entity.SetmealDish;
import com.sky.vo.DishItemVO;
import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;

import java.util.List;

@Mapper
public interface SetmealDishMapper {

    List<Long> getCategoryIdsByDishIds(List<Long> dishIds);

    void insert(List<SetmealDish> setmealDishes);
    @Delete("delete from setmeal_dish where setmeal_id=#{setmealId}")
    void deleteBySetmealId(Long setmealId);

    /**
     * 根据setmealId查询setmealDishes
     * @param setmealId
     * @return
     */
    @Select("select * from setmeal_dish where setmeal_id=#{setmealId}")
    List<SetmealDish> selectBysetmealId(Long setmealId);
    @Select("select sd.copies,d.description,d.image,d.name\n" +
            " from setmeal_dish sd,dish d where sd.dish_id=d.id and sd.setmeal_id=#{setmealId}")
    List<DishItemVO> selectDishItemsBysetmealId(Long setmealId);
}
